package com.spider.silence.job;

import com.spider.silence.downloader.ChengduLifeDownLoader;
import com.spider.silence.pool.ChengduLifeDownLoaderPool;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.StatefulJob;

import java.util.List;

/**
 * Created by qiuhao on 2017/2/7.
 */
public class ChengDuLifeJob implements StatefulJob {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        ChengduLifeDownLoader downLoader=null;
        try{
            downLoader= ChengduLifeDownLoaderPool.getInstance().fetchDownLoader(1000);
            List<String> urlList=downLoader.getModulesUrlList();
            downLoader.generateTask(urlList);
        }catch (InterruptedException e){
            e.printStackTrace();
        }finally {
            ChengduLifeDownLoaderPool.getInstance().releaseDownLoader(downLoader);
        }
    }
}
